////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*

Graphic LCD Nokia 3310 (LPH7779) header file
CCS compiler
dsrex

by Rolf Ziegler 2006

*/
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef __NOKIA3310_Driver
#define __NOKIA3310_Driver

#include "typedef.h"

//#define Nokia_BL1    LATDbits.LATD6
//#define Nokia_BL2    LATDbits.LATD7

#define Nokia_sclk   LATDbits.LATD0
#define Nokia_sda    LATDbits.LATD1    // goes to SDI of LCD
#define Nokia_dc     LATDbits.LATD5
#define Nokia_cs     LATDbits.LATD6    // active low
#define Nokia_res    LATDbits.LATD7    // reset, active low
#define Nokia_trissclk   TRISDbits.TRISD0
#define Nokia_trissda    TRISDbits.TRISD1    // goes to SDI of LCD
#define Nokia_trisdc     TRISDbits.TRISD5
#define Nokia_triscs     TRISDbits.TRISD6    // active low
#define Nokia_trisres    TRISDbits.TRISD7    // reset, active low

//#define  I2CADDinit 0x22

void 	Nokia_init(void);
void    Nokia_write_command(u8 byteforNokia_command);
void 	Nokia_write_data(u8 byteforNokia_data);
void 	Nokia_write_dorc(u8 byteforNokia);
void 	Nokia_gotoxy(u8 xNokia, u8 yNokia);
void 	Nokia_erase_y(u8 yNokia);
void 	Nokia_erase_x(u8 xNokia);
void 	Nokia_printchar(u8 cvar);
void 	Nokia_clean_ddram(void);
void 	table_to_Nokialcd(void);
void 	Nokia_plot(u8 xNokia,u8 plot_value8);
void 	Nokia_write_data_inv(u8 byteforNokia_data_inv);
void    Nokia_clear_screen(void);
void 	Nokia_clear_xy(u8 xNokia, u8 yNokia);
void 	Nokia_print_uparrow(void);
void 	Nokia_print_downarrow(void);
void 	Nokia_print_leftarrow(void);
void 	Nokia_print_rightarrow(void);
void 	Nokia_print_degree(void);
void 	Nokia_print_lowbatdegree(void);
void    lcd_printfl (u8 *message,u8 len, u8 line);
void    lcd_print(u8 *message);


void    Nokia_printchar(u8 cvar);					// Write 1 character to LCD
void    lcd_printf (u8 *message, int line);		// Write message to LCD line i (C string type)
void    lcd_clear();

#define lcd_init Nokia_init
#define lcd_gotoxy Nokia_gotoxy
#define lcd_putc Nokia_printchar

    void lcd_clear();

    int  _user_putc(char c); // this will redirect _H_USER stream to the lcd routine

#endif

